﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using YLPublicService.Extensions;
using System.Data.Common;
using System.Data;

using YLPublicService.TransferModel;

namespace YLPublicService
{


    public partial class AdminService
    {       /// <summary>
        /// 最高管理员才可以更新,money可正负
        /// </summary>
        /// <param name="userLoginName"></param>
        /// <param name="money">可正负</param>
        /// <param name="guid"></param>
        public void UpdateUserAccount(string userLoginName, decimal money, Guid guid)
        {
            if (!isOnline(guid))
                return;
            if (getCurrentUser(guid).IsAdmin == false)
                return;
            var accout = from u in dbContext.Users
                         join account in dbContext.UserAccounts on u.UserID equals account.UserID
                         where u.LoginName == userLoginName
                         select account;
            accout.First().Money += money;
            dbContext.SubmitChanges();
        }
    }
}